﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using DQYT.HTDZ.IDAL;
using Best.Framework.DALFactory;
using DQYT.HTDZ.Model;
using System.Data;

namespace DQYT.HTDZ.BLL
{
    public class BDDepartmentBLL
    {
        private readonly IBDDepartment dal = DataAccess.CreateBDDepartment();

        #region  Method

        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(int BUM_ID)
        {
            return dal.Exists(BUM_ID);
        }


        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(BDDepartmentModel model)
        {
            return dal.Add(model);
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(BDDepartmentModel model)
        {
            return dal.Update(model);
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(int BUM_ID)
        {
            return dal.Delete(BUM_ID);
        }
        /// <summary>
        /// 批量删除数据
        /// </summary>
        public bool DeleteList(string BUM_IDlist)
        {
            return dal.DeleteList(BUM_IDlist);
        }


        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public BDDepartmentModel GetModel(int BUM_ID)
        {
            return dal.GetModel(BUM_ID);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            return dal.GetList(strWhere);
        }

        /// <summary>
        /// 获取记录总数
        /// </summary>
        public int GetRecordCount(string strWhere)
        {
            return dal.GetRecordCount(strWhere);
        }
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
        {
            return dal.GetListByPage(strWhere, orderby, startIndex, endIndex);
        }

        #endregion  Method

        #region 新添加
        /// <summary>
        /// 获得部门人数
        /// </summary>
        /// <param name="BUM_ID">部门ID</param>
        /// <returns></returns>
        public int GetRenShu(int BUM_ID)
        {
            return dal.GetRenShu(BUM_ID);
        }

        /// <summary>
        /// 获得最大上级ID
        /// </summary>
        /// <returns></returns>
        public int GetMaxSJID()
        {
            return dal.GetMaxSJID();
        }
        /// <summary>
        /// 获得下一个ID
        /// </summary>
        /// <returns></returns>
        public int GetNextBUM_ID()
        {
            return dal.GetNextBUM_ID();
        }
        /// <summary>
        /// 判断是否存在当前部门名称
        /// </summary>
        /// <param name="BUM_MC">部门名称</param>
        /// <returns></returns>
        public bool CheckMC(string BUM_MC)
        {
            return dal.CheckMC(BUM_MC);
        }
        #endregion
    }
}
